<template>
	<view>
		<view class="input-row">
			<image class="image" src="/static/me/weixin.png" mode="scaleToFill"></image>
			<input disabled="true" class="uni-h4 m-input" type="text" :value="weixin1"/>
			<button @click="copyKefu(weixin1)" type="default" size="mini">复制微信</button>
		</view>
		<view class="input-row">
			<image class="image" src="/static/me/weixin.png" mode="scaleToFill"></image>
			<input disabled="true" class="uni-h4 m-input" type="text" :value="weixin2"/>
			<button @click="copyKefu(weixin2)" type="default" size="mini">复制微信</button>
		</view>
		
		<view class="input-row">
			<image class="image" src="/static/me/qq.png" mode="scaleToFill"></image>
			<input disabled="true" class="uni-h4 m-input" type="text" :value="qq1"/>
			<button @click="copyKefu(qq1)" type="default" size="mini">复制QQ</button>
		</view>
		
		<view class="input-row">
			<image class="image" src="/static/me/mail.png" mode="scaleToFill"></image>
			<input disabled="true" class="uni-h4 m-input" type="text" :value="email1"/>
			<button @click="copyKefu(email1)" type="default" size="mini">复制邮箱</button>
		</view>
	</view>
</template>

<script>

export default {
	data() {
		return {
			weixin1: "kaqie",
			weixin2: "kbqie",
			qq1: "2924811900",
			email1: "2924811900@qq.com"
		}
	},
	components: {},
	mounted() {
		this.initKefu();
	},
	methods: {
		initKefu() {
			var that = this;
			uni.getStorage({
				key: "version",
				success(res) {
					var data = JSON.parse(res.data);
					that.weixin1 = data.weixin1;
					that.weixin2 = data.weixin2;
					that.qq1 = data.qq1;
					that.email1 = data.email1;
				}
			})
		},
		copyKefu(text) {
			uni.setClipboardData({
			    data: text,
			    success: function () {
					uni.showToast({title: '已复制',duration: 3000})
			    }
			});
		}
	}
}
</script>

<style>
.input-row {
	flex-direction: row;
	padding: 26upx 26upx 0 26upx;
	justify-content: space-between;
	align-items: center;
}
.m-input {
	flex: 1;
}
.image {
	width: 48upx;
	height: 48upx;
	margin:  0 12upx 0 0;
}
</style>